<!DOCTYPE html>
<html>

	<head>
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta charset="utf-8">
		<title>个人资料</title>
		<link rel="stylesheet" type="text/css" href="css/personalData2.css" />
		<link rel="stylesheet" type="text/css" href="css/svg/font.css" />
		<script type="text/javascript">
			window.onload = function() {
				document.documentElement.style.fontSize = document.documentElement.clientWidth / 320 * 20 + 'px';
				window.onresize = function() {
					document.documentElement.style.fontSize = document.documentElement.clientWidth / 320 * 20 + 'px';
				};
			};
		</script>
		<script src="js/jquery-1.11.2.js"></script>
	</head>

	<body id="body">
		<!--头部开始-->
		<header>
			<a href="javascript:;" id="goback"><i class="icon-arrow-left2"></i></a>
			<span>个人资料</span>
			<img src='img/gengduoImg.jpg'>
		</header>
		<!--头部结束-->
		<!--中间开始-->
		<section>
			<ul>
				<li>
					<p>淘宝头像</p>
					<a href="javascript:;"></a>
					<i>></i>
				</li>
				<li>
					<p>会员名</p>
					<div>心若相依</div>
					<i>></i>
				</li>
				<a href="xiugainicheng.html">
					<li>
						<p>淘宝昵称</p>
						<div id="nickname"></div>
						<i>></i>
					</li>
				</a>
				<li id="show">
					<p>性别</p>
					<div id="sex"></div>
					<i>></i>
				</li>
				<li>
					<p>我的二维码名片</p>
					<img src="img/erweima.png" />
					<i>></i>
				</li>
				<a href="guanlishouhuodizhi.html">
					<li class="li">
						<p>我的收货地址</p>
						<div id="shouhuodiz"></div>
						<i>></i>
					</li>
				</a>
			</ul>
		</section>
		<!--中间结束-->
		<!--性别框开始-->
		<div id="hide">
			<p>修改性别</p>
			<p id="nan">男</p>
			<p id="nv">女</p>
		</div>
		<!--性别框结束-->
		<!--背影显示隐藏开始-->
		<div id="chezhao"></div>
		<!--背影显示隐藏结束-->
	</body>
	<script>
		$(function() {
			$("#goback").click(function() {
				window.history.back(-1);
			})
			//点击性别框显示隐藏开始
			var startBtn = true;
			show.addEventListener('click', function() {
				startBtn = !startBtn;
				startBtn ? (hide.style.display = 'none', chezhao.style.display = 'none') : (hide.style.display = 'block', chezhao.style.display = 'block');
			}, false);
			//点击性别框显示隐藏结束
			//背影显示隐藏开始
			var onan = document.getElementById('nan');
			var onv = document.getElementById('nv');
			onan.addEventListener('click', getNCXBDZ, false);
			onv.addEventListener('click', getNCXBDZ, false);
			//背影显示隐藏结束
			
			function getNCXBDZ(){
				localStorage.user_sex = this.innerHTML;
				sex.innerHTML = this.innerHTML;
				$.ajax({
					type: "post",
					url: "http://192.168.1.100/supermarket/data/user_update_sex.php",
					async: true,
					data: {
					'user_sex': sex.innerHTML,
					'user_phone': localStorage.user_phone
					},
					dataType: 'jsonp', //使用jsop开始跨域
					jsonp: 'callback', //告诉后台，我需要一个回调函数
					jsonpCallback: "success_jsonpCallback", //回调函数的名称
					success: function(data) {
//						debugger;
						hide.style.display = 'none';
						chezhao.style.display = 'none';
					},
					error: function(data) {}
				})
			}
			
			if(localStorage.user_sex){
				$('#sex').text(localStorage.user_sex);
			}else{
				$('#sex').text('');
			}
			
			if(localStorage.name){
				$('#nickname').html(localStorage.name);
			}else{
				$('#nickname').html('');
			}
			if(localStorage.addr){
				$('#shouhuodiz').text(localStorage.addr);
			}else{
				$('#shouhuodiz').text('');
			}
			
		})
	</script>

</html>